﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using util;

namespace WebApplication1.dormitoryAdministrator
{
    public partial class StayOvernightReport : System.Web.UI.Page
    {
        String hostel;
        protected void Page_Load(object sender, EventArgs e)
        {
            hostel = (String)Application["hostel"];
            SqlDataSource1.SelectCommand = "SELECT * FROM `out_and_stay_application` where type = 0 and hostel = '"+hostel+"'";
        }



        protected void select_Click(object sender, EventArgs e)
        {
            String sql = "SELECT * FROM `out_and_stay_application` where type = 0 and name = '" + selectName.Text + "'";
            DataTable data = MySqlHelper.GetDataTable(sql);
            GridView1.DataSource = data;
            GridView1.DataSourceID = null;
            GridView1.DataBind();
        }

     
        protected void selectAll_Click(object sender, EventArgs e)
        {
            GridView1.DataSource = null;
            GridView1.DataSourceID = "SqlDataSource1";
            GridView1.DataBind();
        }
    }
}